package com.example.controller.user;

import com.example.common.Result;
import com.example.entity.order.Order;
import com.example.service.UserService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/order")
public class OrderController {
    @Resource
    private UserService userService;


    //立即下单
    @PostMapping("/SubmitOrder")
    public Result SubmitOrder(@RequestBody Order order) {
        String trackingNumber = userService.SubmitOrder(order);
        return Result.success(trackingNumber);
    }

    //订单付款与否
    @PutMapping("/IfPay")
    public Result IfPay(@RequestParam String trackingNumber, @RequestParam String state) {
        userService.IfPay(trackingNumber, state);
        return Result.success();
    }
}
